import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.util.Scanner;

public class pr {
    public static void main(String[] args) {
int ret=jie(5);
        System.out.println(ret);
        Scanner scanner=new Scanner(System.in);
        while(true){
        int num=scanner.nextInt();
        if(num==-1){
            break;
        }
        System.out.println(num);
    }
    }
    public static int fac(int a){
        int sum=1;
        for (int i = 1; i <= a; i++) {
            sum*=i;
        }
        return sum;
    }
    public static int jie(int x){
        int num=0;
        for (int i = 1; i <=x ; i++) {
num+=fac(i);
        }
        return num;
    }

















    public static void main2(String[] args) {
    int i=7;
    int count=0;
    while(i!=0){
    i&=(i-1);
    count++;
    }
        System.out.println(count);
        int x=3,y=1;
        int c=add(x,y);
        System.out.println(c);
    }


public static int add(int a,int b)
{
    return a+b;
}









    public static void main1(String[] args) {
        int i;
        for(i=1;i<999999;i++)
        {
            int count=0;
            int tem=i;
            while(tem!=0)
            {
                tem/=10;
                count++;
            }
            tem=i;
            int g=0;
           while(tem!=0){
               g+=Math.pow(tem%10,count);
               tem/=10;
            }
            if(i==g)
            {
                System.out.println(i);
            }
        }
    }
}
